const KEY = 'USER_INFO_KEY'
import Cookie from 'js-cookie'
/**
 * 保存用户信息
 * @param {*} user
 */
export const saveUser = user => {
	Cookie.set(KEY, JSON.stringify(user), { expires: 1 })
}

/**
 * 获取用户信息
 */
export const getUser = () => {
	let userStr = Cookie.get(KEY)
	if (userStr) {
		return JSON.parse(userStr)
	}
	return null
}

/**
 * 删除用户信息
 */
export const removeUser= ()=>{
    Cookie.remove(KEY)
}

